package com.itheima.thread.Demo8_阻塞队列;

import java.util.concurrent.ArrayBlockingQueue;

public class Demo8 {
    public static void main(String[] args) throws InterruptedException {
        // 创建阻塞队列的对象,容量为 1
        ArrayBlockingQueue bq = new ArrayBlockingQueue(1);
        // 存储元素
        bq.put("汉堡包");
        // 取元素
        System.out.println(bq.take());
        System.out.println(bq.take());// 取不到会阻塞

        System.out.println("程序结束了");
    }
}
